# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=libsrtp
pkgver=2.6.0
pkgrel=0
pkgdesc="implementation of the Secure Real-time Transport Protocol (SRTP)"
url="https://github.com/cisco/libsrtp"
arch="all"
license="BSD-3-Clause"
makedepends="libpcap-dev meson openssl-dev"
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/cisco/libsrtp/archive/refs/tags/v$pkgver.tar.gz"

case "$CARCH" in
	s390x) options="$options !check" ;;
esac

build() {
	abuild-meson \
		-Dtests="$(want_check && echo enabled || echo disabled)" \
		-Dcrypto-library=openssl \
		-Dpcap-tests=enabled \
		builddir .
	meson compile -C builddir
}

check() {
	meson test --no-rebuild --print-errorlogs -C builddir
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C builddir
}

sha512sums="
96f6e2b7300a416a10e5cc45cf67dadf2f4f81119267689cac4296e2dc6d73398457d1a56b651ab4be6da9e701564d3f256bf6d5f42add5eb2b9b9fe8e438a74  libsrtp-2.6.0.tar.gz
"
